/*! For license information please see index.js.LICENSE.txt */ (()=>{var e={539(e){var t={utf8:{stringToBytes:function(e){return t.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(t.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,o=0;n>>5]|=e[n]<<24-o%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n>>6*(3-a)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],o=0,r=0;o>>6-2*r);return n}},e.exports=n},445(e){function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},892(e,t,n){var o,r,a,l,i;o=n(635),r=n(539).utf8,a=n(445),l=n(539).bin,(i=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?l.stringToBytes(e):r.stringToBytes(e):a(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=o.bytesToWords(e),_=8*e.length,s=1732584193,c=-271733879,u=-1732584194,p=271733878,f=0;f>>24)|4278255360&(n[f]<<24|n[f]>>>8);n[_>>>5]|=128<<_%32,n[14+(_+64>>>9<<4)]=_;var d=i._ff,m=i._gg,h=i._hh,v=i._ii;for(f=0;f>>0,c=c+y>>>0,u=u+w>>>0,p=p+b>>>0}return o.endian([s,c,u,p])})._ff=function(e,t,n,o,r,a,l){var i=e+(t&n|~t&o)+(r>>>0)+l;return(i<>>32-a)+t},i._gg=function(e,t,n,o,r,a,l){var i=e+(t&o|n&~o)+(r>>>0)+l;return(i<>>32-a)+t},i._hh=function(e,t,n,o,r,a,l){var i=e+(t^n^o)+(r>>>0)+l;return(i<>>32-a)+t},i._ii=function(e,t,n,o,r,a,l){var i=e+(n^(t|~o))+(r>>>0)+l;return(i<>>32-a)+t},i._blocksize=16,i._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=o.wordsToBytes(i(e,t));return t&&t.asBytes?n:t&&t.asString?l.bytesToString(n):o.bytesToHex(n)}},500(e,t){var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e="",t=0;t{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{if(Array.isArray(t))for(var o=0;oObject.hasOwn(e,t),(()=>{"use strict";var e,t,o,r,a,l,i,_,s,c,u,p,f,d,m,h={},v=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,y=Array.isArray;function w(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function C(t,n,o){var r,a,l,i={};for(l in n)"key"==l?r=n[l]:"ref"==l?a=n[l]:i[l]=n[l];if(arguments.length>2&&(i.children=arguments.length>3?e.call(arguments,2):o),"function"==typeof t&&null!=t.defaultProps)for(l in t.defaultProps)void 0===i[l]&&(i[l]=t.defaultProps[l]);return x(t,i,r,a,null)}function x(e,n,r,a,l){var i={type:e,props:n,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:l??++o,__i:-1,__u:0};return null==l&&null!=t.vnode&&t.vnode(i),i}function N(e){return e.children}function k(e,t){this.props=e,this.context=t}function S(e,t){if(null==t)return e.__?S(e.__,e.__i+1):null;for(var n;tt&&r.sort(i),e=r.shift(),t=r.length,T(e)}finally{r.length=A.__r=0}}function I(e,t,n,o,r,a,l,i,_,s,c){var u,p,f,d,m,g,y,w=o&&o.__k||v,b=t.length;for(_=H(n,t,w,_,b),u=0;u0?l=e.__k[a]=x(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[a]=l,_=a+p,l.__=e,l.__b=e.__b+1,i=null,-1!=(s=l.__i=D(l,n,_,u))&&(u--,(i=n[s])&&(i.__u|=2)),null==i||null==i.__v?(-1==s&&(r>c?p--:r_?p--:p++,l.__u|=4))):e.__k[a]=null;if(u)for(a=0;a(c?1:0))for(r=n-1,a=n+1;r>=0||a=0?r--:a++])&&!(2&s.__u)&&i==s.key&&_==s.type)return l;return-1}function R(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||g.test(t)?n:n+"px"}function O(e,t,n,o,r){var a,l;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||R(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||R(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])a=t!=(t=t.replace(u,"$1")),l=t.toLowerCase(),t=l in e||"onFocusOut"==t||"onFocusIn"==t?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[c]=o[c]:(n[c]=p,e.addEventListener(t,a?d:f,a)):e.removeEventListener(t,a?d:f,a);else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=n??"";break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function M(e){return function(n){if(this.l){var o=this.l[n.type+e];if(null==n[s])n[s]=p++;else if(n[s]0?e:y(e)?e.map(W):void 0!==e.constructor?null:w({},e)}function F(n,o,r,a,l,i,_,s,c){var u,p,f,d,m,v,g,w=r.props||h,C=o.props,x=o.type;if("svg"==x?l="http://www.w3.org/2000/svg":"math"==x?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),null!=i)for(u=0;u=n.__.length&&n.__.push({}),n.__[e]}function _e(e){return X=1,se(we,e)}function se(e,t,n){var o=ie(J++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):we(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=G,!G.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,l=o.__c.props!==e;if(o.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(l=!0)}}),a){var i=a.call(this,e,t,n);return r?i||l:i}return!r||l};G.__f=!0;var a=G.shouldComponentUpdate,l=G.componentWillUpdate;G.componentWillUpdate=function(e,t,n){if(this.__e){var o=a;a=void 0,r(e,t,n),a=o}l&&l.call(this,e,t,n)},G.shouldComponentUpdate=r}return o.__N||o.__}function ce(e,t){var n=ie(J++,3);!ee.__s&&ye(n.__H,t)&&(n.__=e,n.u=t,G.__H.__h.push(n))}function ue(e){return X=5,pe(function(){return{current:e}},[])}function pe(e,t){var n=ie(J++,7);return ye(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function fe(e,t){return X=8,pe(function(){return e},t)}function de(){for(var e;e=Q.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ve),t.__h.some(ge),t.__h=[]}catch(n){t.__h=[],ee.__e(n,e.__v)}}}ee.__b=function(e){G=null,te&&te(e)},ee.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),le&&le(e,t)},ee.__r=function(e){ne&&ne(e),J=0;var t=(G=e.__c).__H;t&&(Y===G?(t.__h=[],G.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(ve),t.__h.some(ge),t.__h=[],J=0)),Y=G},ee.diffed=function(e){oe&&oe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Q.push(t)&&K===ee.requestAnimationFrame||((K=ee.requestAnimationFrame)||he)(de)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),Y=G=null},ee.__c=function(e,t){t.some(function(e){try{e.__h.some(ve),e.__h=e.__h.filter(function(e){return!e.__||ge(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],ee.__e(n,e.__v)}}),re&&re(e,t)},ee.unmount=function(e){ae&&ae(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{ve(e)}catch(e){t=e}}),n.__H=void 0,t&&ee.__e(t,n.__v))};var me="function"==typeof requestAnimationFrame;function he(e){var t,n=function(){clearTimeout(o),me&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);me&&(t=requestAnimationFrame(n))}function ve(e){var t=G,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),G=t}function ge(e){var t=G;e.__c=e.__(),G=t}function ye(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function we(e,t){return"function"==typeof t?t(e):t}function be(e,t){for(var n in t)e[n]=t[n];return e}function Ce(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function xe(e,t){this.props=e,this.context=t}(xe.prototype=new k).isPureReactComponent=!0,xe.prototype.shouldComponentUpdate=function(e,t){return Ce(this.props,e)||Ce(this.state,t)};var Ne=t.__b;t.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ne&&Ne(e)};var ke="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Se(e){function t(t){var n=be({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=ke,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Te=t.__e;t.__e=function(e,t,n,o){if(e.then)for(var r,a=t;a=a.__;)if((r=a.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t);Te(e,t,n,o)};var qe=t.unmount;function Ee(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=be({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Ee(e,t,n)})),e}function Ae(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Ae(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Ie(){this.__u=0,this.o=null,this.__b=null}function He(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Le(){this.i=null,this.l=null}t.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),qe&&qe(e)},(Ie.prototype=new k).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=He(o.__v),a=!1,l=function(){a||o.__z||(a=!0,n.__R=null,r?r(_):_())};n.__R=l;var i=n.__P;n.__P=null;var _=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=Ae(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=i,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(l,l)},Ie.prototype.componentWillUnmount=function(){this.o=[]},Ie.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Ee(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&C(N,null,e.fallback);return r&&(r.__u&=-33),[C(N,null,t.__a?null:e.children),r]};var Pe=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]{const r=e[o],a=t[o];et(r)&&et(a)&&!Array.isArray(r)?n[o]=tt(r,a):n[o]=a}),n}const nt=function(){function e(t){var n,o;return this.getChildContext||(n=new Set,(o={})[e.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,E(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),t.children}return e.__c="__cC"+m++,e.__=void 0,e.Provider=e.__l=(e.Consumer=function(e,t){return e.children(t)}).contextType=e,e}(),ot=(e,t)=>{const{contacts:n,contactId:o,storeName:r}=t.payload||{};switch(t.type){case"PERSIST_STATE":return((e,t,n=30)=>{let o=localStorage.getItem(e);if(o)o=JSON.parse(o),o.value=t;else{const e=new Date;o={value:t,expiration:new Date(e.getTime()+24*n*60*60*1e3).getTime()}}try{localStorage.setItem(e,JSON.stringify(o))}catch(t){if("QuotaExceededError"===t.name){console.warn("localStorage quota exceeded. Attempting to clear old data...");try{localStorage.removeItem(e),localStorage.setItem(e,JSON.stringify(o))}catch(e){console.error("Failed to save to localStorage even after clearing:",e)}}else console.error("Error saving to localStorage:",t)}})(r,{...e,contactsHash:Ye()(JSON.stringify(t.payload.contacts))}),e;case"HYDRATE_STATE":const a=(e=>{const t=localStorage.getItem(e);if(t){const n=JSON.parse(t);return(new Date).getTime()>n.expiration?(localStorage.removeItem(e),null):n.value}return null})(r),l=Ye()(JSON.stringify(n));return a?a.contactsHash!==l?{...Qe,contactsHash:l}:(n.find(e=>"bot"===e.type?e.bot_id===o:e.id===o)||(a.contactId=null),{...a}):e;case"SET_CONTACT_ID":if(null===o)return{...e,contactId:null};const i=n.find(e=>"bot"===e.type?e.bot_id===o:e.id===o),_=i?.message||"",s=e.contactsConversation[o];return s&&(s?.messageListArray?.[0]?.text||"")===_?{...e,contactId:o}:tt(e,{contactId:o,contactsConversation:{[o]:{messageListArray:""!==_?[{id:"",source:"user",text:_,status:""}]:[]}}});case"SET_GENERAL_CONSENT_ACCEPTED":const{accepted:c}=t.payload;return{...e,generalConsentAccepted:c}}return e},rt=()=>function(e){var t=G.context[e.__c],n=ie(J++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(G)),t.props.value):e.__}(nt),at=e=>{const{contacts:t,children:n}=e,[o,r]=se(ot,Qe),a=Xe,l=fe(()=>{try{const e=[];for(let t=0;tlocalStorage.removeItem(e))}catch(e){console.warn("Failed to cleanup old storage entries:",e)}},[]),i=fe(()=>{r({type:"PERSIST_STATE",payload:{contacts:t,storeName:a}})},[t,a]),_=fe(()=>{r({type:"HYDRATE_STATE",payload:{contacts:t,storeName:a}})},[t,a]);return ce(()=>{l()},[l]),ce(()=>{_()},[_]),ce(()=>{i()},[o,i]),C(nt.Provider,{value:{...o,...e,setContactId:e=>{r({type:"SET_CONTACT_ID",payload:{contacts:t,contactId:e,storeName:a}})},setGeneralConsentAccepted:e=>{r({type:"SET_GENERAL_CONSENT_ACCEPTED",payload:{accepted:e}})}}},n)},lt=(e,t,n)=>e,it=(e,...t)=>{let n=0;return e.replace(/%(\d+\$)?s/g,(e,o)=>{var r,a;return o?null!==(r=t[parseInt(o)-1])&&void 0!==r?r:"":null!==(a=t[n++])&&void 0!==a?a:""})},_t=()=>C("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32"},C("path",{d:"M20.563 22.104l-1.875 1.875-8-8 8-8 1.875 1.875-6.125 6.125z"})),st=()=>C("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},C("path",{d:"M12.001 2C6.47813 2 2.00098 6.47715 2.00098 12C2.00098 13.8893 2.50433 15.6617 3.38779 17.1902L2.05176 21.9922L6.97471 20.6842C8.45617 21.4958 10.1729 21.9999 12.001 21.9999C17.5238 21.9999 22.001 17.5228 22.001 11.9999C22.001 6.47706 17.5238 2 12.001 2ZM8.49659 7.3125C8.67819 7.3125 8.86375 7.31328 9.02603 7.32031C9.22603 7.32734 9.44788 7.34053 9.65845 7.82813C9.90845 8.39648 10.4397 9.76758 10.5084 9.91016C10.577 10.0527 10.6221 10.2198 10.5303 10.4023C10.4385 10.5848 10.3928 10.6987 10.2513 10.8633C10.1097 11.0273 9.95431 11.2295 9.82618 11.3574C9.68399 11.499 9.53643 11.653 9.70165 11.9355C9.86688 12.2181 10.4347 13.1504 11.2822 13.9082C12.3713 14.8828 13.2886 15.1826 13.5713 15.3252C13.854 15.4678 14.0226 15.4443 14.1878 15.2598C14.353 15.0752 14.8979 14.4336 15.0859 14.1504C15.274 13.8672 15.4619 13.916 15.7212 14.0117C15.9806 14.1074 17.3516 14.7773 17.6343 14.9199C17.917 15.0625 18.1059 15.1348 18.1748 15.2539C18.2441 15.373 18.2441 15.9414 18.0098 16.6074C17.7754 17.2734 16.6284 17.9072 16.1064 17.9531C15.5845 17.999 15.0918 18.1928 12.7432 17.2754C9.91772 16.1738 8.09619 13.3047 7.95361 13.1152C7.81103 12.9258 6.80176 11.5723 6.80176 10.1719C6.80176 8.77148 7.52759 8.08398 7.7876 7.79883C8.04736 7.51367 8.31494 7.3125 8.49659 7.3125Z"})),ct={phone:st,group:()=>C("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},C("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"})),bot:()=>C("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},C("path",{fillRule:"evenodd",d:"M13.5 2C13.5 2.44425 13.3069 2.84339 13 3.11805V5H18C19.6569 5 21 6.34315 21 8V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V8C3 6.34315 4.34315 5 6 5H11V3.11805C10.6931 2.84339 10.5 2.44425 10.5 2C10.5 1.17157 11.1716 0.5 12 0.5C12.8284 0.5 13.5 1.17157 13.5 2ZM2 10H0V16H2V10ZM22 10H24V16H22V10ZM10.5 13C10.5 13.8284 9.82843 14.5 9 14.5C8.17157 14.5 7.5 13.8284 7.5 13C7.5 12.1716 8.17157 11.5 9 11.5C9.82843 11.5 10.5 12.1716 10.5 13ZM15 14.5C15.8284 14.5 16.5 13.8284 16.5 13C16.5 12.1716 15.8284 11.5 15 11.5C14.1716 11.5 13.5 12.1716 13.5 13C13.5 13.8284 14.1716 14.5 15 14.5Z"}))},ut=({contact:e})=>{const{box:t}=rt(),n=e?.type||"phone";return C("div",{className:"qlwapp__avatar"},C("div",{className:"qlwapp__avatar__type-badge","aria-hidden":"true"},C(ct[n]||st,null)),C("span",{className:"qlwapp__avatar__sr-only"},n),C("div",{className:"qlwapp__avatar__container"},e?.avatar?function(e){try{return new URL(e),!0}catch(e){return!1}}(e.avatar)?C("img",{src:e.avatar,alt:e.firstname,loading:"yes"===t.lazy_load&&"lazy"}):C("div",{className:"qlwapp__avatar__container qlwapp__avatar__container--icon"},C("span",null,e?.avatar)):C("div",{className:"qlwapp__avatar__container qlwapp__avatar__container--icon"},C("span",null,e?.name?.charAt(0).toUpperCase()))))},pt=(e,t)=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t(e))},ft=({onClose:e,onPrevious:t})=>{const{contactId:n,box:o,contacts:r}=rt(),a=r.find(e=>"bot"===e.type?e.bot_id===n:e.id===n);return C("div",{className:"qlwapp__header"},C("i",{className:"qlwapp__close",onClick:e,onKeyDown:t=>pt(t,e),role:"button",tabIndex:"0"},"×"),C("div",{className:"qlwapp__carousel"},C("div",{className:"qlwapp__carousel-slide"},o.header&&C("div",{className:"qlwapp__header-description",dangerouslySetInnerHTML:{__html:o.header}})),C("div",{className:"qlwapp__carousel-slide"},C("div",{className:"qlwapp__header-contact"},C("div",{className:"qlwapp__header-contact-buttons"},C("a",{className:"qlwapp__previous",onClick:t,onKeyDown:e=>pt(e,t),role:"button",tabIndex:"0"},C(_t,null))),C("div",{className:"qlwapp__info"},C("span",{className:"qlwapp__name"},`${a?.firstname} ${a?.lastname}`),C("span",{className:"qlwapp__time"},a?.timefrom!==a?.timeto&&it(lt("Available from %1$s to %2$s"),a?.timefrom,a?.timeto),a?.label&&` - ${a?.label}`)),C(ut,{contact:a})))))},dt=()=>C("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32"},C("path",{d:"M2.776 31.54c-1.954 1.036-3.144 0.122-2.658-2.038l2.066-9.17c0.246-1.086 1.318-2.068 2.432-2.2l12.39-1.44c3.296-0.38 3.308-0.996 0-1.374l-12.39-1.416c-1.1-0.126-2.18-1.080-2.424-2.17l-2.080-9.264c-0.486-2.146 0.704-3.046 2.662-2.006l25.7 13.658c1.956 1.038 1.96 2.72 0 3.76l-25.7 13.66z"})),mt=()=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t=window.matchMedia("(pointer:coarse)");return t&&t.matches||e},ht=({type:e,group:t,phone:n,message:o,whatsapp_link_type:r="web"})=>{const a=mt()?"api":r,l="api"===a?"https://api.whatsapp.com/send":"https://web.whatsapp.com/send";if("group"===e){const e=(e=>{try{const t=new URL(e);if("chat.whatsapp.com"===t.hostname)return t.pathname.replace("/","");if("web.whatsapp.com"===t.hostname&&"/accept"===t.pathname)return t.searchParams.get("code")}catch(e){console.error("Invalid URL",e)}return null})(t);return"api"===a?`https://chat.whatsapp.com/${e}`:`https://web.whatsapp.com/accept?code=${e}`}return`${l}?phone=${function(e){return(e=e.replace(new RegExp("[^0-9]","g"),"")).replace(new RegExp("^0+"),"")}(n?.toString())}&text=${encodeURIComponent(function(e){const t=document.createElement("textarea");return t.innerHTML=e,t.value}(o))}`};function vt(e){const t=ht(e),n=new CustomEvent("qlwapp.click",{bubbles:!0,cancelable:!0});window.dispatchEvent(n),window.open(t,"_blank","noreferrer")}const gt=()=>{const{box:e,contacts:t,contactId:n,generalConsentAccepted:o}=rt(),r=t.find(e=>"bot"===e.type?e.bot_id===n:e.id===n),[a,l]=_e(""),i=ue(),_=ue(null),s="yes"===e?.consent_enabled&&!o,c=!a.trim()||s;ce(()=>{i.current&&i.current.focus()},[]);const u=(e=!1)=>{const t=i.current;t&&(t.style.height="",e||""===a||(t.style.height=`${t.scrollHeight}px`))},p=e=>{e.preventDefault(),(()=>{if(c)return;const e=a.trim();l(""),u(!0),vt({...r,message:e})})()},f=fe(e=>{if(_.current&&(_.current.disconnect(),_.current=null),!e)return;const t=()=>{const t=e.getBoundingClientRect().width;document.documentElement.style.setProperty("--qlwapp-button-width",`${t}px`)};t();const n=requestAnimationFrame(t),o=new ResizeObserver(t);return o.observe(e),_.current=o,()=>{cancelAnimationFrame(n),o.disconnect()}},[]);return C(N,null,e?.footer&&C("div",{className:"qlwapp__footer",dangerouslySetInnerHTML:{__html:e.footer}}),C("div",{className:"qlwapp__response"},C("pre",{className:"qlwapp__response__input"},a),C("textarea",{className:"qlwapp__response__input",name:"message",ref:i,maxLength:"300",onChange:e=>{e.preventDefault(),l(e.target.value),u()},onKeyDown:e=>{e.shiftKey&&"Enter"===e.key||"Enter"!==e.key||c||p(e)},value:a,placeholder:e?.response,"aria-label":e?.response,tabIndex:"0",disabled:s}),C("div",{className:"qlwapp__response__buttons",ref:f},C("a",{className:Je()("qlwapp__reply",c&&"qlwapp__reply--disabled"),role:"button",tabIndex:"0",onClick:p,title:"Send",target:"blank"},C(dt,null)))))};function yt(e,t){return parseInt(e+t)}function wt(e){let t=""+e.getMinutes();return 1===t.length&&(t="0"+t),e.getHours()+":"+t}const bt=({timezone:e,timefrom:t,timeto:n,timedays:o})=>{const r=(({timedays:e})=>{const t=(new Date).getDay().toString();return e?.includes(t)||0===e?.length})({timedays:o}),a=function(e){let t=0;if(e?.includes("UTC")){const n=e.replace(new RegExp("UTC\\+?"),"");isNaN(n)||(t=60*parseInt(n))}else try{const n=(new Date).toLocaleString("en-US",{timeZone:e});t=(new Date(n+" UTC")-new Date)/6e4}catch(e){return 0}return t}(e),l=new Date,i=new Date,_=new Date;let s=i.getTime(),c=l.getTime();if(t!==n){const e=-_.getTimezoneOffset()-(a||0);let o,u;o=yt(t[0],t[1]),u=yt(t[3],t[4]),i.setHours(o),i.setMinutes(u+e),s=i.getTime(),o=yt(n[0],n[1]),u=yt(n[3],n[4]),l.setHours(o),l.setMinutes(u+e),c=l.getTime(),s>c&&(s-=864e5);const p=s<=_.getTime()&&_.getTime()<=c;return{isAvailableNow:r&&p,isInAvailableDay:r,isInAvailableHour:p,timefrom:wt(i),timeto:wt(l)}}return{isAvailableNow:r,isInAvailableDay:r,isInAvailableHour:!0}};function Ct(e,t){return!!e.includes(parseInt(t))||!!e.includes(t.toString())}function xt({timedays:e,timezone:t}){const n=function(e){try{let t=new Date;const n={weekday:"long"},o=function(e){const t=e.match(new RegExp("^UTC([+-]\\d{1,2})$"));return t?60*parseInt(t[1],10)*60*1e3:null}(e);if(null!==o){const e=new Date(t.getTime()+6e4*t.getTimezoneOffset()+o);n.timeZone="UTC",t=e}else n.timeZone=e;return{Sunday:0,Monday:1,Tuesday:2,Wednesday:3,Thursday:4,Friday:5,Saturday:6}[new Intl.DateTimeFormat("en-US",n).formatToParts(t).find(e=>"weekday"===e.type).value]}catch(e){return null}}(t);if(null===n)return!1;const o=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];for(let t=n;t<=6;t++)if(Ct(e,t))return o[t];for(let t=0;t{const{box:n,generalConsentAccepted:o}=rt(),{isAvailableNow:r,isInAvailableDay:a,isInAvailableHour:l,timefrom:i,timeto:_}=bt(e);if(!r&&"hidden"===e.visibility)return;const s=xt(e),c="yes"===n?.consent_enabled&&!o;return C("a",{className:Je()("qlwapp__contact",!r&&"readonly"===e.visibility||c?"qlwapp__contact--disabled":""),onClick:t,onKeyDown:pt,role:"button",tabIndex:"0",target:"_blank"},C(ut,{contact:e}),C("div",{className:"qlwapp__info"},C("span",{className:"qlwapp__label"},e?.label),C("span",{className:"qlwapp__name"},"bot"===e?.type?e?.firstname:`${e?.firstname} ${e?.lastname}`),"with_status"===e?.visibility&&C("div",{className:"qlwapp__status qlwapp__info"},C("div",{className:"qlwapp__status__indicator "+(r?"qlwapp__status__indicator--online":"qlwapp__status__indicator--offline")}),C("span",{className:"qlwapp__status__text"},r?"Online":"Offline")),a?!l&&C("span",{className:"qlwapp__time"},it(lt("Available from %1$s to %2$s"),i,_)):s&&C("span",{className:"qlwapp__time"},it(lt("Available on %s"),s))))},kt=({onClick:e})=>{const[,t]=(()=>{const[e,t]=_e(!1);return[e,e=>{t(!0),setTimeout(()=>{e(),t(!1)},0)}]})(),n=ue(null),{box:o,contacts:r,setContactId:a,generalConsentAccepted:l}=rt(),i=n=>r=>{r.preventDefault(),"yes"===o?.consent_enabled&&!l||(n.chat||"bot"===n?.type?(e("qlwapp__modal--opening"),t(()=>{a("bot"===n.type?n.bot_id:n.id)})):vt(n))},_=()=>{const e=document.querySelector(".qlwapp__header")?.offsetHeight,t=o.footer?document.querySelector(".qlwapp__footer")?.offsetHeight:document.querySelector(".qlwapp__response")?.offsetHeight;let n=window.innerHeight-e-t;mt()&&(n=.7*window.innerHeight-e-t),document.documentElement.style.setProperty("--qlwapp-scheme-box-height",`${n}px`)};return ce(()=>(window.addEventListener("resize",_()),window.addEventListener("load",_()),()=>{window.removeEventListener("resize",_()),window.removeEventListener("load",_())}),[]),ce(()=>{const e=n.current;if(!e)return;const t=t=>{const n=e.scrollTop<=0,o=Math.ceil(e.scrollTop)+e.clientHeight>=e.scrollHeight;(n&&t.deltaY<0||o&&t.deltaY>0)&&t.preventDefault()};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]),C("div",{ref:n,className:"qlwapp__contact-list"},r.length?r.map(e=>C(Nt,{key:e.id,contact:e,onClick:i(e)})):C("div",{className:"qlwapp__contact-list__empty"},"No contacts found."))};var St={"":["",""],_:["",""],"*":["",""],"~":["",""],"\n":["
"]," ":["
"],"-":["
"]};function Tt(e){return e.replace(RegExp("^"+(e.match(/^(\t| )+/)||"")[0],"gm"),"")}function qt(e){return(e+"").replace(/"/g,""").replace(//g,">")}function Et(e,t){var n,o,r,a,l,i=/((?:^|\n+)(?:\n---+|\* \*(?: \*)+)\n)|(?:^``` *(\w*)\n([\s\S]*?)\n```$)|((?:(?:^|\n+)(?:\t| {2,}).+)+\n*)|((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+)|(?:!\[([^\]]*?)\]\(([^)]+?)\))|(\[)|(\](?:\(([^)]+?)\))?)|(?:(?:^|\n+)([^\s].*)\n(-{3,}|={3,})(?:\n+|$))|(?:(?:^|\n+)(#{1,6})\s*(.+)(?:\n+|$))|(?:`([^`].*?)`)|( \n\n*|\n{2,}|__|\*\*|[_*]|~~)/gm,_=[],s="",c=t||{},u=0;function p(e){var t=St[e[1]||""],n=_[_.length-1]==e;return t?t[1]?(n?_.pop():_.push(e),t[0|n]):t[0]:e}function f(){for(var e="";_.length;)e+=p(_[_.length-1]);return e}for(e=e.replace(/^\[(.+?)\]:\s*(.+)$/gm,function(e,t,n){return c[t.toLowerCase()]=n,""}).replace(/^\n+|\n+$/g,"");r=i.exec(e);)o=e.substring(u,r.index),u=i.lastIndex,n=r[0],o.match(/[^\\](\\\\)*\\$/)||((l=r[3]||r[4])?n='
"+Tt(qt(l).replace(/^\n+|\n+$/g,""))+"
":(l=r[6])?(l.match(/\./)&&(r[5]=r[5].replace(/^\d+/gm,"")),a=Et(Tt(r[5].replace(/^\s*[>*+.-]/gm,""))),">"==l?l="blockquote":(l=l.match(/\./)?"ol":"ul",a=a.replace(/^(.*)(\n|$)/gm,"
  • $1
  • ")),n="<"+l+">"+a+""):r[8]?n=''+qt(r[7])+'':r[10]?(s=s.replace("",''),n=f()+""):r[9]?n="":r[12]||r[14]?n="<"+(l="h"+(r[14]?r[14].length:r[13]>"="?1:2))+">"+Et(r[12]||r[15],c)+"":r[16]?n=""+qt(r[16])+"":(r[17]||r[1])&&(n=p(r[17]||"--"))),s+=o,s+=n;return(s+e.substring(u)+f()).replace(/^\n+|\n+$/g,"")}function At(e){if(null==e)return"";const t=new RegExp("(https?:\\/\\/[^\\s<]+)","g"),n=[];let o=Et(e.replace(t,e=>{const t=`URLPLACEHOLDER${n.length}URLPLACEHOLDER`;return n.push(e),t}));return n.forEach((e,t)=>{const n=`URLPLACEHOLDER${t}URLPLACEHOLDER`;o=o.replace(n,e)}),o}const It=e=>{if(!e||"string"!=typeof e)return e;const t=document.createElement("textarea");return t.innerHTML=e,t.value.replace(new RegExp("&","g"),"&").replace(new RegExp("<","g"),"<").replace(new RegExp(">","g"),">").replace(new RegExp('"',"g"),""").replace(new RegExp("'","g"),"'").replace(new RegExp("\\n","g"),"
    ")},Ht=({text:e,status:t,source:n})=>{const o={__html:At(It(e))};return C("div",{className:Je()("qlwapp__message",n&&`qlwapp__message--${n}`,t&&`qlwapp__message--${t}`)},C("div",{dangerouslySetInnerHTML:o}))},Lt=()=>{const e=ue(null),t=ue(null),{contactId:n,contactsConversation:o}=rt(),{messageListArray:r=[]}=o[n]||{messageListArray:[]};return ce(()=>{e.current&&r.length>0&&setTimeout(()=>{e.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},[700])},[r]),ce(()=>{const e=t.current;if(!e)return;const n=t=>{const n=e.scrollTop<=0,o=Math.ceil(e.scrollTop)+e.clientHeight>=e.scrollHeight;(n&&t.deltaY<0||o&&t.deltaY>0)&&t.preventDefault()};return e.addEventListener("wheel",n,{passive:!1}),()=>e.removeEventListener("wheel",n)},[]),C("div",{ref:t,className:"qlwapp__message-list"},r.map(e=>C(Ht,{key:e.id,...e})),C("span",{ref:e}))},Pt=()=>{const{contactId:e,box:t,generalConsentAccepted:n}=rt(),o=e;return!o||"yes"===t?.consent_enabled&&!n?null:C("iframe",{key:o,className:"qlwapp__bot-frame",src:`https://viewer.quick.bot/${encodeURIComponent(o)}`,title:"Chatbot conversation",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-downloads",allow:"microphone; clipboard-write"})},Dt=()=>{const{box:e,generalConsentAccepted:t,setGeneralConsentAccepted:n}=rt(),[o,r]=_e(!0),[a,l]=_e(!1),i="yes"===e?.consent_enabled,_=e?.consent_message||"I accept cookies and privacy policy.";return i&&o?C("div",{className:`qlwapp__general-consent ${a?"qlwapp__general-consent--accepted":""} ${t?"":"qlwapp__general-consent--required"}`},C("label",{className:"qlwapp__general-consent-label"},C("input",{id:"qlwapp_general_consent",type:"checkbox",checked:t,onChange:e=>{const t=e.target.checked;n(t),t&&(l(!0),setTimeout(()=>{r(!1)},1e3))},className:"qlwapp__general-consent-checkbox",required:!0,"aria-required":"true"}),C("span",{className:"qlwapp__general-consent-text",dangerouslySetInnerHTML:{__html:_}}))):null},Rt=Se(({handleBoxClose:e},t)=>{const{contactId:n,setContactId:o,contacts:r}=rt(),[a,l]=_e(""),i=null!==n,_=r?.find(e=>"bot"===e.type?e.bot_id===n:e.id===n),s="bot"===_?.type;return C("div",{ref:t,className:Je()("qlwapp__modal",i&&"qlwapp__modal--response",a)},C(ft,{onClose:e,onPrevious:e=>{e.preventDefault(),l("qlwapp__modal--closing"),setTimeout(()=>{o(null),l("")},[300])}}),C("div",{className:"qlwapp__body"},C("div",{className:"qlwapp__carousel"},C("div",{className:"qlwapp__carousel-slide"},C(kt,{onClick:l})),C("div",{className:"qlwapp__carousel-slide"},null!==n&&C(s?Pt:Lt,null)))),C(Dt,null),!s&&C(gt,null))}),Ot=Se((e,t)=>C(Rt,{...e,ref:t})),Mt=e=>(e=>!(!e||"string"!=typeof e)&&(e.startsWith("http")||e.startsWith("https")||/\.(jpg|jpeg|png|gif|svg|webp)$/i.test(e)||e.includes(".")))(e)?C("img",{src:e,alt:"Custom Icon",className:"qlwapp__icon"}):C("i",{className:Je()("qlwapp__icon",e)}),$t=function({onClick:e}){const{button:t,primaryContact:n,isModalOpen:o}=rt();if(!n)return null;const{isAvailableNow:r,isInAvailableDay:a,isInAvailableHour:l,timefrom:i,timeto:_}=bt(t);if(!r&&"hidden"===t.visibility)return;const s=xt(t);return C("a",{className:Je()("qlwapp__button",`qlwapp__button--${t.layout}`,!r&&"qlwapp__button--disabled"),role:"button",tabIndex:"0",onClick:o=>(o=>{o.preventDefault(),"yes"===t.box?e(o):(e=>{e.preventDefault(),vt(n)})(o)})(o)},"image"===t.layout?Mt(t.icon):C(N,null,Mt(t.icon),"bubble"===t.layout&&C("i",{className:"qlwapp__close"},"×"),t.text&&C("span",{className:"qlwapp__text"},t.text)),"bubble"===t.notification_bubble&&r&&!o&&C("span",{className:Je()("qlwapp__notification-bubble",t.notification_bubble_animation&&`qlwapp__notification-bubble--${t.notification_bubble_animation}`),"aria-label":"New message notification"},"1"),a?!l&&C("span",{className:"qlwapp__time"},it(lt("Available from %1$s to %2$s"),i,_)):s&&C("span",{className:"qlwapp__time"},it(lt("Available on %s"),s)))},Ut=()=>window.innerWidth<=430&&mt(),Bt=({children:e,containerRef:t,boxTransitionClass:n,isMobilePreview:o})=>{const[r,a]=_e(Ut()),{button:l}=rt(),i="yes"===l.rounded;ce(()=>{const e=()=>{a(Ut())};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const _=r||o;return C("div",{ref:t,className:Je()("qlwapp__container",`qlwapp__container--${l.position}`,i&&"qlwapp__container--rounded",_&&"qlwapp-is-mobile",n)},e)},Wt=e=>!("hide"===e||"desktop"===e&&mt()||"mobile"===e&&!mt()),Ft=e=>e?(Array.isArray(e)||(e=Object.values(e)),e.filter(e=>{const t=Wt(e?.display?.devices),n="hidden"===e?.visibility&&!bt(e).isAvailableNow;return t&&!n}).sort((e,t)=>{const n=void 0!==e.order&&null!==e.order?e.order:Number.MAX_SAFE_INTEGER,o=void 0!==t.order&&null!==t.order?t.order:Number.MAX_SAFE_INTEGER;return n===o?0:n{const{box:t,button:n,contacts:o,isMobilePreview:r,previewContainerRef:a}=e,l=Ft(o),i=ue(null),_=ue(null),[s,c]=_e(!1),[u,p]=_e(""),f="qlwapp_box_closed",d="yes"===t.auto_open&&"yes"===n.box,m="true"===function(e){const t=document.cookie.match("(^|;) ?"+e+"=([^;]*)(;|$)");return t?t[2]:null}(f),h=Number(t.auto_delay_open);ce(()=>{d&&!m&&setTimeout(()=>{c(!0)},h)},[]),ce(()=>{const e=t.allow_outside_close||"no",n=t=>{s&&"yes"===e&&_.current&&!_.current.contains(t.target)&&(a?.current?a.current.contains(t.target)&&v(t):v(t))};if(s&&"yes"===e)return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[s,t.allow_outside_close,a]);const v=e=>{e?.preventDefault(),p("qlwapp__container--closing"),function(e){let t="";{const e=new Date;e.setTime(e.getTime()+6048e5),t="; expires="+e.toUTCString()}document.cookie=e+"=true"+t+"; path=/"}(f),setTimeout(()=>{c(!1),p("")},300)};return C(at,{...e,contacts:l,isModalOpen:s},C(Bt,{isMobilePreview:r,boxTransitionClass:u,containerRef:i},s&&C(Ot,{ref:_,handleBoxClose:v}),C($t,{onClick:()=>{s?v():(c(!0),p("qlwapp__container--opening"),setTimeout(()=>{p("qlwapp__container--open")},300))}})))});document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".qlwapp").forEach(e=>{var t,n,o,r,a,l,i;const _=null!==(t=JSON.parse(e.getAttribute("data-display")))&&void 0!==t?t:{},s=null!==(n=JSON.parse(e.getAttribute("data-button")))&&void 0!==n?n:{},c=null!==(o=JSON.parse(e.getAttribute("data-box")))&&void 0!==o?o:{},u=null!==(r=s?.devices)&&void 0!==r?r:_?.devices;if(!Wt(u))return;const p=null!==(a=JSON.parse(e.getAttribute("data-contacts")))&&void 0!==a?a:[],f=Ft(p),d=e.hasAttribute("data-primary-contact")?null!==(l=JSON.parse(e.getAttribute("data-primary-contact")))&&void 0!==l?l:null:null!==(i=p[0])&&void 0!==i?i:null;Ve(e).render(C(zt,{display:_,button:s,box:c,contacts:f,primaryContact:d}))}),document.addEventListener("click",e=>{const t=e.target.closest('[data-action="open"]');if(!t)return;e.preventDefault();const n=t.dataset.phone,o=t.dataset.message,r=t.dataset.whatsappLinkType||"api";if(!n)return;const a=ht({type:"phone",phone:n,message:o,whatsappLinkType:r}),l=new CustomEvent("qlwapp.click",{bubbles:!0,cancelable:!0});window.dispatchEvent(l),window.open(a,"_blank","noreferrer")})})})()})();